#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    connect(ui->cmdline,SIGNAL(returnPressed()),this,SLOT(on_browbutton_clicked()));

    connect(ui->cancelbutton,&QPushButton::clicked,this,&Widget::on_cancel_clicked);


    connect(ui->commitbutton,&QPushButton::clicked,[this](){
        QMessageBox::information(this,"信息","点击浏览");

    });

}

Widget::~Widget()
{
    delete ui;
}

//信号与槽的方式
void Widget::on_browbutton_clicked()
{
    //获取这个横线的消息
    QString program=ui->cmdline->text();
    //启动进程
    QProcess *myProcess = new QProcess(this);
    myProcess->start(program);

}
void Widget::on_cancel_clicked()
{
   this->close();

}
